<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>键盘按下</title>
		<script src="js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<label>请输入姓名</label><input type="text" id="" value="" />
		<p>按下键盘的时候，文本框的颜色会变</p>
	</body>
</html>
<script type="text/javascript">
	$(document).ready(()=>{
		$("input").keydown(()=>{
			$("input").css("background-color","pink")
		})
		$("input").keyup(()=>{
			$("input").css("background","none")
		})
	})
</script>
